<template>
	<view>
		<form>
			<view class="cu-form-group">
				<view class="title">收货人</view>
				<input placeholder="请输入收货人姓名" name="input" @input="receivename"></input>
			</view>
			<view class="cu-form-group">
				<view class="title">手机号码</view>
				<input placeholder="输入收货人手机号码" name="input" @input="receivephone"></input>
				<view class="cu-capsule radius">
					<view class='cu-tag bg-blue '>
						+86
					</view>
					<view class="cu-tag line-blue">
						中国大陆
					</view>
				</view>
			</view>
			<view class="cu-form-group">
				<view class="title">省(市)</view>
				<input placeholder="请输入所在省,市" name="input" @input="provinceid"></input>
			</view>
			<view class="cu-form-group">
				<view class="title">市(区，县)</view>
				<input placeholder="请输入所在市" name="input" @input="cityid"></input>
			</view>
			<view class="cu-form-group">
				<view class="title">区，县(镇)</view>
				<input placeholder="请输入所在区、县、镇" name="input" @input="areaid"></input>
			</view>
			<view class="cu-form-group align-start">
				<view class="title">详细地址</view>
				<textarea maxlength="-1" :disabled="modalName!=null" @input="address" placeholder="街道,楼牌号等"></textarea>
			</view>
			<view class="cu-form-group">
				<view class="title">设置默认地址</view>
				<input placeholder="请输入是或者否" name="input" v-model="Address.addressstatus"></input>
			</view>
			<view class="cu-bar btn-group">
				<button class="cu-btn bg-green shadow-blur round lg" @click="add">保存</button>
			</view>
		</form>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				index: -1,
				Address: {
					'receivename': "",
					'receivephone': "",
					'provinceid': "",
					'cityid': "",
					'areaid': "",
					'address': "",
					addressstatus: ""
				}
			}
		},
		onLoad: function() {
			
		},
		methods: {
			receivename(a) {
				this.Address.receivename = a.target.value
			},
			receivephone(a) {
				this.Address.receivephone = a.target.value
			},
			provinceid(a) {
				this.Address.provinceid = a.target.value
			},
			cityid(a) {
				this.Address.cityid = a.detail.value
			},
			areaid(a) {
				this.Address.areaid = a.detail.value
			},
			address(a) {
				this.Address.address = a.target.value
			},
			addressstatus(a) {
				this.Address.addressstatus = a.detail.value
			},
			add() {
				    console.log(this.Address)
					this.$req.newAddress(this.Address).then(res => {
						console.log(res)
						this.Address = res.data
					})
			},
		}
	}
</script>
<style>
	.all {
		border: 1rpx solid #8F8F94;
	}

	.all>view {
		margin-top: 30rpx;
	}

	.consignee {
		display: flex;
	}
</style>
